package com.smec.moblie.service;

import android.app.IntentService;
import android.content.Context;
import android.content.Intent;

import com.smec.moblie.activity.MainDetailActivity;
import com.smec.moblie.control.MainControl;

/**
 * 初始化本地mntjob数据
 * Created by sunxinwei on 16/1/21.
 */
public class MntJobService extends IntentService {

    private static final String ACTION_MNTJOB = "com.smec.moblie.service.action.MNTJOB";

    public static void startMntJobService(Context context) {
        Intent intent = new Intent(context, MntJobService.class);
        intent.setAction(ACTION_MNTJOB);
        context.startService(intent);
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        if (intent != null) {
            final String action = intent.getAction();
            if (ACTION_MNTJOB.equals(action)) {
                MainControl.getMntjobtpldetail(this);
                MainControl.getMntjobitem(this);
                MainControl.getMntjobtemplate(this);
                Intent intent1 = new Intent(MainDetailActivity.MNTJOBSERVICE_RESULT);
                sendBroadcast(intent1);
            }
        }
    }

    public MntJobService() {
        super("MntJobService");
    }
}
